<template>
  <a-card :bordered='false'>
    <search :config='searchConfig' @search='search' @getHeight='getHeight'/>
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-94'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :toolbar-config="tableToolbar"
        :checkbox-config="checkboxConfig"
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all="selectChangeEvent"
      >
        <template #toolbar_buttons>
          <div class='table-operator'>
            <a-button @click="handleAdd" type="primary">新增</a-button>
            <!--<a-button tabindex="primary" @click="batchDel">删除</a-button>-->
            <!--<a-button type="primary" @click="downExportXls('sign_config')">导出</a-button>-->
            <!--<a-button type="primary">日志</a-button>-->
          </div>
        </template>
        <template #action='{ row,rowIndex }'>
          <a @click='handleEdit(row)'>编辑</a>
          <!--<a-divider type='vertical' />-->
          <!--<a href='javascript:;' @click='handleBusiness("收货地址",row)'>日志</a>-->
        </template>
        <template #receivingAddressCode='{ row,rowIndex }'>
          <a @click="handleDetail(row)">{{ row.receivingAddressCode }}</a>
        </template>
        <template #update='{ row }'>
          <a-switch :checked='row.status' size='small' @change='handleStatus(row,$event)'/>
        </template>
      </vxe-grid>
    </div>
    <!-- 弹出框 -->
    <sfa-new-sign-config-modal ref="modalForm" @ok="modalFormOk"></sfa-new-sign-config-modal>
  </a-card>
</template>

<script>
  import '@/assets/less/TableExpand.less'
  import SfaNewSignConfigModal from './modules/SfaNewSignConfigModal'
  import { PageListMixin } from '@/mixins/PageListMixin'
  import ARow from 'ant-design-vue/es/grid/Row'
  import ARangePicker from 'ant-design-vue/es/date-picker/RangePicker'

  export default {
    name: 'NewSignConfigList',
    mixins: [PageListMixin],
    components: {
      ARangePicker,
      ARow,
      SfaNewSignConfigModal
    },
    data() {
      return {

        description: '考勤规则页面',

        // 表头
        searchConfig: [
          {
            type: 'date',
            name: 'signConfigName',
            placeholder: '规则名称'
          }
        ],

        columns: [
          {
            minWidth: 60,
            type: 'checkbox'
          },
          {
            title: '规则类型',
            minWidth: 100,
            field: 'signInStart'
          },
          {
            title: '规则编码',
            minWidth: 100,
            field: 'signInEnd'
          },
          {
            title: '规则名称',
            minWidth: 100,
            field: 'signOutStart'
          },
          {
            title: '创建人',
            minWidth: 60,
            field: 'signOrgName'
          },
          {
            title: '创建时间',
            minWidth: 100,
            field: 'createName'
          },
          {
            title: '更新人',
            minWidth: 80,
            field: 'createTime'
          },
          {
            title: '更新时间',
            minWidth: 100,
            field: 'updateName'
          },
          {
            title: '更新时间',
            minWidth: 80,
            field: 'updateTime'
          },
          {
            title: '启停状态',
            align: 'left',
            field: 'status',
            width: 80,
            fixed: 'right',
            minWidth: 80,
            slots: { default: 'status' }
          },
          {
            title: '操作',
            fixed: 'right',
            minWidth: 120,
            field: 'action',
            slots: {
              default: 'action'
            }
          }
        ],
        url: {
          list: window._CONFIG['domianSfaURL'] + '/signConfig/findPageList',
          delete: window._CONFIG['domianSfaURL'] + '/signConfig/deleteById',
          deleteBatch: window._CONFIG['domianSfaURL'] + '/signConfig/deleteBatch',
          startOrStopUrl: window._CONFIG['domianSfaURL'] + '/signConfig/status/startOrStop'
        }
      }
    },

    methods: {

    }
  }
</script>

<style scoped>
  @import '~@assets/less/common.less';
</style>